#!/bin/bash
#	File : wifidirect.conf

######################### WIFIDIRECT Configuration command ##################

wifidirect_config={
	# Arrange in order of subelement Ids
    #
	# WIFIDIRECT IE parameters. 
    #

	Capability={
		DeviceCapability=33
		GroupCapability=8
	}
	GroupOwnerIntent={
		Intent=5                       # 0-15. 15-> highest GO desire
	}
	Channel={                          # Listen channel attribute.
		CountryString="US"
		RegulatoryClass=81
		ChannelNumber=6
	}
	InfrastructureManageabilityInfo={
		Manageability=0
	}
	ChannelList={
		CountryString="US"
		# multiple attributes channel entry list
		Regulatory_Class_1=81              # Regulatory class
		NumofChannels_1=11                 # No of channels
		ChanList_1=1,2,3,4,5,6,7,8,9,10,11 # Scan channel list 
		Regulatory_Class_2=115             # Regulatory class
		NumofChannels_2=4                  # No of channels
		ChanList_2=36,40,44,48             # Scan channel list
		#Regulatory_Class_3=118            # Regulatory class
		#NumofChannels_3=4                 # No of channels
		#ChanList_3=52,56,60,64            # Scan channel list
		#Regulatory_Class_4=121            # Regulatory class
		#NumofChannels_4=11                # No of channels
		#ChanList_4=100,104,108,112,116,120,124,128,132,136,140            # Scan channel list
		# Enable only one of the country blocks at a time 
		#CountryString="JP"
		# multiple attributes channel entry list
		#Regulatory_Class_1=81              # Regulatory class
		#NumofChannels_1=13                 # No of channels
		#ChanList_1=1,2,3,4,5,6,7,8,9,10,11,12,13 # Scan channel list 
		#Regulatory_Class_2=115             # Regulatory class
		#NumofChannels_2=4                  # No of channels
		#ChanList_2=36,40,44,48             # Scan channel list
		#Regulatory_Class_3=118            # Regulatory class
		#NumofChannels_3=4                 # No of channels
		#ChanList_3=52,56,60,64            # Scan channel list
		#Regulatory_Class_4=121            # Regulatory class
		#NumofChannels_4=11                # No of channels
		#ChanList_4=100,104,108,112,116,120,124,128,132,136,140            # Scan channel list
	}
	NoticeOfAbsence={
		NoA_Index=0                 # Instance of NoA timing
		OppPS=1                     # Opportunistic Power save
		CTWindow=10                 # Client Traffic Window
		NoA_descriptor={
			CountType_1=255           # Count for GO mode OR Type for client mode
			Duration_1=51200            # Max absence duration for GO mode OR
                                    # min acceptable presence period for client mode
			Interval_1=102400
			StartTime_1=0
			#CountType_2=1           # Count for GO mode OR Type for client mode
			#Duration_2=0            # Max absence duration for GO mode OR 
                                    # min acceptable presence period for client mode
			#Interval_2=0
			#StartTime_2=0
			}
	}
	DeviceInfo={
		DeviceAddress=00:50:43:00:00:00
		# categ: 2 bytes, OUI: 4 bytes, subcateg: 2 bytes
		PrimaryDeviceTypeCategory=1
		PrimaryDeviceTypeOUI=0x00,0x50,0xF2,0x04
		PrimaryDeviceTypeSubCategory=1
		SecondaryDeviceCount=2
		SecondaryDeviceType={
		    SecondaryDeviceTypeCategory_1=6
		    SecondaryDeviceTypeOUI_1=0x00,0x50,0xF2,0x04
		    SecondaryDeviceTypeSubCategory_1=1
		    SecondaryDeviceTypeCategory_2=4
		    SecondaryDeviceTypeOUI_2=0x00,0x50,0xF2,0x04
		    SecondaryDeviceTypeSubCategory_2=1
		}
		DeviceName=MRVL_DEFAULT_NAME
		# ConfigMethods USB= 0x01 
		# ConfigMethods Ethernet= 0x02 
		# ConfigMethods Label= 0x04 
		# ConfigMethods Display= 0x08 
		# ConfigMethods Ext_NFC_Token= 0x10
		# ConfigMethods Int_NFC_Token= 0x20
		# ConfigMethods NFC_Interface= 0x40
		# ConfigMethods PushButton= 0x80
		# ConfigMethods KeyPad= 0x100
		WPSConfigMethods=0x188
	}
	GroupId={
		GroupAddr=00:50:43:00:00:00
		GroupSsId=DIRECT-
	}
	GroupBSSId={
                # using LAA for interface address by default
		GroupBssId=02:50:43:00:00:00
	}
	DeviceId={
		WIFIDIRECT_MAC=00:50:43:00:00:00      # MAC address of wifidirect device in Hex
	}
	Interface={
                # using LAA for interface addresses by default
		InterfaceAddress=02:50:43:00:00:00
		InterfaceAddressCount=2
		InterfaceAddressList=02:50:43:00:00:00,02:52:43:00:00:00 
	}
	ConfigurationTimeout={
        # units of 10 milliseconds
		GroupConfigurationTimeout=250
		ClientConfigurationTimeout=100
	}
	ExtendedListenTime={
        # units of milliseconds
		AvailabilityPeriod=1000
		AvailabilityInterval=1500
	}
	IntendedIntfAddress={
                # using LAA for interface address by default
		GroupInterfaceAddress=02:50:43:00:00:00
	}
	OperatingChannel={                          # Operating channel attribute.
		CountryString="US"
		OpRegulatoryClass=81
		OpChannelNumber=6
	}
	InvitationFlagBitmap={
		InvitationFlag=0           # bit0: Invitation type:
	}                                   # 0: request to reinvoke a persistent group
                                            # 1: request to join an active WIFIDIRECT group
    

    #Extra={
       #Buffer=0x00,0x50,0x43,0x07,0x20,0xa1 
    #}

    #
	# WPS IE parameters. 
    #
	WPSIE={
		WPSVersion=0x10
		WPSSetupState=0x1
		WPSRequestType=0x0
		WPSResponseType=0x0
		WPSSpecConfigMethods=0x0188
		WPSUUID=0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78
		WPSPrimaryDeviceType=0x00,0x01,0x00,0x50,0xF2,0x04,0x00,0x01
		WPSRFBand=0x01
		WPSAssociationState=0x00
		WPSConfigurationError=0x00
		WPSDevicePassword=0x00
		WPSDeviceName=MRVL_DEFAULT_NAME
		WPSManufacturer=Marvell
		WPSModelName=SD-8787
		WPSModelNumber=0x00,0x00,0x00,0x01
		WPSSerialNumber=0x00,0x00,0x00,0x01
	}
}


######################### WIFIDIRECT Parameters configuration command #######

wifidirect_param_config={
	MinDiscoveryInterval=1
	MaxDiscoveryInterval=7
	EnableScan=1
	#ScanPeerDeviceId=00:50:43:77:43:47
	#ScanRequestDeviceType=0x01,0x00,0x50,0xF2,0x04,0x01,0x3C,0x10
	DeviceState=4
}

######################### WIFIDIRECT Action Frame command ##################

wifidirect_action_frame={
	PeerAddr=00:50:43:00:00:00
	Category=4         # 4 : Public action frame, 0x7F : Vendor specific
	Action=0           # 0xDD : Vendor specific, Others : Reserved.
	OUI=0x50,0x6F,0x9A
	OUIType=9          # WFA wifidirect. 
	                   # 15 : WPSE. 

	# OUI SubType 0 : GO Negotiation Request
	# OUI SubType 1 : GO Negotiation Response
	# OUI SubType 2 : GO Negotiation Confirmation 
	# OUI SubType 3 : WIFIDIRECT Invitation Request
	# OUI SubType 4 : WIFIDIRECT Invitation Response
	# OUI SubType 5 : Device Discoverability Request
	# OUI SubType 6 : Device Discoverability Response
	# OUI SubType 7 : Provision Discovery Request
	# OUI SubType 8 : Provision Discovery Response
 
    #
    # UPDATE LINE BELOW for APPROPRIATE SUB TYPE
    #
	OUISubType=0

	DialogToken=1

	# Arrange in order of subelement Ids
    # Other parameters which can be configured from WIFIDIRECT config command.

	#DeviceId={
	#	WIFIDIRECT_MAC=00:50:43:77:46:41      # MAC address of wifidirect device in Hex
	#}
	#Interface={
	#	InterfaceAddress=00:50:43:77:46:41
	#	InterfaceAddressCount=2
	#	InterfaceAddressList=00:50:43:77:46:41,00:50:43:78:47:42 
	#}
}

######################### WIFIDIRECT service discovery command ##################

wifidirect_discovery_request={
	PeerAddr=00:50:43:00:00:00
	Category=4
	Action=10
	DialogToken=1
	AdvertizementProtocolIE=0x6c,0x02,0x00,0x00
                # octet 1: Element Id = 108 ( 0x6c)
                # octer 2: Length of following fields
                # octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
                #          Bits0-6: Query response length limit.
                # octer 4: Advertizement Protocol ID 
	QueryRequestLen={
	    InfoId=0xDD,0xDD
        RequestLen={
		    OUI=0x50,0x6F,0x9A
		    OUISubType=9
            ServiceUpdateIndicator=0
		    VendorLen={
				ServiceProtocol=0 # 0: All service protocol types 
                                  # 1: Bonjour, 2: uPnP, 3: WS-Discovery
                                  # 255: Vendor specific
				ServiceTransactionId=1
                QueryData={
                    ## Use Data below, if ServiceProtocol=1 (Bonjour). 
                    #
                    ## DNSName can be string or hexadecimal sequence of bytes.
                    #DNSName="_afpovertcp._tcp.local."
                    # DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
                    #DNSType=12
                    #BonjourVersion=1

                    ## Use Data below, if ServiceProtocol=2 (uPnP). 
                    #
                    #uPnPVersion=0x10
                    #uPnPQueryValue="ssdp:all"         #   Searches for all UPnP devices and services
                    #
                    # OR any one of following values in WIFIDIRECT spec.
                    #uPnPQueryValue="upnp:rootdevice"  #   Searches for all UPnP root devices
                    #uPnPQueryValue="uuid:device-uuid" #   Searches for a particular device
                    #uPnPQueryValue="urn:schemas-upnp-org:device:deviceType:ver"
                                                  #   Searches for devices of the given type
                    #uPnPQueryValue="urn:domain-name:device:deviceType:ver"
                                                  #   Searches for devices with a vendor-specific type
                    #uPnPQueryValue="urn:schemas-upnp-org:service:serviceType:ver"
                                                  #   Searches for devices containing a service of the given type
                    #uPnPQueryValue="urn:domain-name:service:serviceType:ver"
                                                  #   Searches for devices containing a vendor-specific service
			    }
			}
        }
    }
}

wifidirect_discovery_response={
	PeerAddr=00:50:43:00:00:00
	Category=4
	Action=11
	DialogToken=1
	StatusCode=0
	GasComebackDelay=0x0000
	AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
                # octet 1: Element Id = 108 ( 0x6c)
                # octer 2: Length of following fields
                # octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
                #          Bits0-6: Query response length limit.
                # octer 4: Advertizement Protocol ID 
	QueryResponseLen={
		InfoId=0xDD,0xDD
		ResponseLen={
			OUI=0x50,0x6F,0x9A
			OUISubType=9
            ServiceUpdateIndicator=0
			VendorLen={
				ServiceProtocol=0 # 0: All service protocol types 
                                  # 1: Bonjour, 2: uPnP, 3: WS-Discovery
                                  # 255: Vendor specific
				ServiceTransactionId=1
				ServiceStatus=0   # 0: Success
                                  # 1: Service protocol type not available
                                  # 2: Query data not available
                                  # 3: Bad request.
                ResponseData={
                    ## Use Data below, if ServiceProtocol=1 (Bonjour). 
                    #
                    ## DNSName can be string or hexadecimal sequence of bytes.

                    DNSName="_afpovertcp._tcp.local."
                    # DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
                    DNSType=12
                    BonjourVersion=1
                    ## RecordData can be string or hexadecimal sequence of bytes.
                    # RecordData=""
                    RecordData=0x00

                    ## Use Data below, if ServiceProtocol=2 (uPnP). 
                    #
                    #uPnPVersion=0x10
                    #uPnPResponseValue="ssdp:all"         #   Searches for all UPnP devices and services
                    #
                    # OR any one of following values in WIFIDIRECT spec.
                    #uPnPResponseValue="upnp:rootdevice"  #   Searches for all UPnP root devices
                    #uPnPResponseValue="uuid:device-uuid" #   Searches for a particular device
                    #uPnPResponseValue="urn:schemas-upnp-org:device:deviceType:ver"
                                                      #   Searches for devices of the given type
                    #uPnPResponseValue="urn:domain-name:device:deviceType:ver"
                                                      #   Searches for devices with a vendor-specific type
                    #uPnPResponseValue="urn:schemas-upnp-org:service:serviceType:ver"
                                                      #   Searches for devices containing a service of the given type
                    #uPnPResponseValue="urn:domain-name:service:serviceType:ver"
                                                      #   Searches for devices containing a vendor-specific service
                }
			}
		}
	}
}

### GAS Comback request and response Frame ###

wifidirect_gas_comeback_request={
	PeerAddr=00:50:43:00:00:00
	Category=4
	Action=12
	DialogToken=1
}

wifidirect_gas_comeback_response={
	PeerAddr=00:50:43:00:00:00
	Category=4
	Action=13
	DialogToken=1
	StatusCode=0
    GasResponseFragID=0x01
        # Bit 7: More GAS fragments bit
        # Bits 0-6: GAS query response fragment ID. 
        #           0 for initial frame and increments subsequently.
	GasComebackDelay=0x0000
	AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
                # octet 1: Element Id = 108 ( 0x6c)
                # octer 2: Length of following fields
                # octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
                #          Bits0-6: Query response length limit.
                # octer 4: Advertizement Protocol ID 
	QueryResponseLen={
		InfoId=0xDD,0xDD
		ResponseLen={
			OUI=0x00,0x50,0xF2
			OUISubType=9
            ServiceUpdateIndicator=0
			VendorLen={
				ServiceProtocol=1 # 0: All service protocol types 
                                  # 1: Bonjour, 2: uPnP, 3: WS-Discovery
                                  # 255: Vendor specific
				ServiceTransactionId=1
				ServiceStatus=0   # 0: Success
                                  # 1: Service protocol type not available
                                  # 2: Query data not available
                                  # 3: Bad request.
                ResponseData={
                    ## Use Data below, if ServiceProtocol=1 (Bonjour). 
                    #
                    ## DNSName can be string or hexadecimal sequence of bytes.

                    # DNSName="_afpovertcp._tcp.local."
                    DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
                    DNSType=12
                    BonjourVersion=1
                    ## RecordData can be string or hexadecimal sequence of bytes.
                    # RecordData=""
                    RecordData=0x00

                    ## Use Data below, if ServiceProtocol=2 (uPnP). 
                    #
                    #uPnPVersion=0x10
                    #uPnPResponseValue="ssdp:all"         #   Searches for all UPnP devices and services
                    #
                    # OR any one of following values in WIFIDIRECT spec.
                    #uPnPResponseValue="upnp:rootdevice"  #   Searches for all UPnP root devices
                    #uPnPResponseValue="uuid:device-uuid" #   Searches for a particular device
                    #uPnPResponseValue="urn:schemas-upnp-org:device:deviceType:ver"
                                                      #   Searches for devices of the given type
                    #uPnPResponseValue="urn:domain-name:device:deviceType:ver"
                                                      #   Searches for devices with a vendor-specific type
                    #uPnPResponseValue="urn:schemas-upnp-org:service:serviceType:ver"
                                                      #   Searches for devices containing a service of the given type
                    #uPnPResponseValue="urn:domain-name:service:serviceType:ver"
                                                      #   Searches for devices containing a vendor-specific service
                }
			}
		}
	}
}
